package model.run;

import java.util.Date;

import mode.enumeration.Direction;
import model.listener.CheckPointListener;
import utils.NoLimeUtils;
import controller.NLSimulator;
import controller.view.impl.NLSimulatorSwingView;
import estimation.impl.MediaMovelJ3;
import estimation.impl.MinimosQuadradosJ3;

public class Treino1 {	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
				
		NLSimulator transportPlan = new NLSimulator(0, 0);
		
		CheckPointListener cpi = new CheckPointListener() {

			public void reached(NLSimulator m) {
				System.out.println("x:" + m.getRunner().getPosition().getX() + "/"
						+ m.getRunner().getPosition().getY() + " - time:"
						+ NoLimeUtils.formatTime(new Date().getTime()));
				
			
				System.out.println("(MM)Prevendo evento em "+m.Predict(MediaMovelJ3.class, 9)+" segundos");
				System.out.println("(MQ)Prevendo evento em "+m.Predict(MinimosQuadradosJ3.class, 9)+" segundos");
				
			}
		};
		
		CheckPointListener cpi2 = new CheckPointListener() {

			public void reached(NLSimulator m) {
				System.out.println("x:" + m.getRunner().getPosition().getX() + "/"
						+ m.getRunner().getPosition().getY() + " - time:"
						+ NoLimeUtils.formatTime(new Date().getTime()));				
			}
		};

		transportPlan.addCommand(Direction.HORIZONTAL, 45);
		transportPlan.addCommand(Direction.VERTICAL, 10);
		transportPlan.addCommand(Direction.HORIZONTAL, 7);
		transportPlan.addCommand(Direction.VERTICAL, -10);
		transportPlan.addCommand(Direction.HORIZONTAL, 10);

		transportPlan.addCheckPoint(20, 0, cpi);
		
		transportPlan.addCheckPoint(29, 0, cpi2);
		
		new NLSimulatorSwingView(transportPlan);

	}

}

